package com.qianxi.wit.result;

public class Result {
    private String code;
    private String msg;
    private Object data;
    private long current;
    private long total;

    public long getCurrent() {
        return current;
    }

    public long getTotal() {
        return total;
    }

    public String getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public Object getData() {
        return data;
    }

    private Result(CodeMsg codeMsg){

    }
    private Result(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    private Result(String code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    private Result(String code, String msg, Object data, long current, long total) {
        this.code = code;
        this.msg = msg;
        this.data = data;
        this.current = current;
        this.total = total;
    }

    public static Result success(Object result){
        return new Result("００1０００","访问成功",result);
    }

    public static Result success(long current,long total,Object result){
        return new Result("００1０００","访问成功",result,current,total);
    }

    public static Result error(CodeMsg codeMsg){
        return new Result(codeMsg.getCode(),codeMsg.getMsg());
    }
}